<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <div class="well form-inline margin-top-20""><a class="btn btn-default" href="{:url('Alsdk/DescribeUserDomains')}"><<返回域名列表</a>&nbsp;&nbsp;{$domain}</div>
    <ul class="nav nav-tabs">
        <li class="active"><a href="javascript:;">转码配置信息列表</a></li>
        <li><a href="{:url('Alsdk/AddLiveStreamTranscode', array('domain'=>$domain))}">添加转码配置</a></li>
        <li><a href="{:url('Alsdk/AddCustomLiveStreamTranscode', array('domain'=>$domain))}">添加自定义转码配置</a></li>
    </ul>
    <form class="js-ajax-form" action="" method="post">
        <div class="table-actions">
        </div>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="15">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <notempty name="category">
                    <th width="50">{:lang('SORT')}</th>
                </notempty>
                <th>应用名称</th>
                <th>转码模版</th>
                <th>转码视频比特率<br>单位：kbps</th>
                <th>转码视频帧率<br>单位：fps</th>
                <th>转码视频高度</th>
                <th>转码视频宽度</th>
                <th>自定义转码模版类型</th>
                <th>操作</th>
            </tr>
            </thead>
            <foreach name="info" item="vo">
                <tr>
                    <td>
                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo->DomainName}" title="ID:{$vo->DomainName}">
                    </td>
                    <td>{$vo->TranscodeApp}</td>
                    <?php $TranscodeTemplate = $vo->TranscodeTemplate;?>
                    <td>
                        <if condition="$TranscodeTemplate eq 'ld'" />流畅(LD)
                        <elseif condition="$TranscodeTemplate eq 'sd'" />标清(SD)
                        <elseif condition="$TranscodeTemplate eq 'hd'" />高清(HD)
                        <elseif condition="$TranscodeTemplate eq 'ud'" />超清(UD)
                        <else />窄带高清/{$TranscodeTemplate}    
                        </if>
                    </td>
                    <td>{$vo->CustomTranscodeParameters->VideoBitrate}</td>
                    <td>{$vo->CustomTranscodeParameters->FPS}</td>
                    <td>{$vo->CustomTranscodeParameters->Height}</td>
                    <td>{$vo->CustomTranscodeParameters->Width}</td>
                    <td>{$vo->CustomTranscodeParameters->TemplateType}</td>
                    <td>
                        <a class="btn btn-danger btn-sm" style="margin:1px;" onclick="DeleteLiveStreamTranscode('{$domain}', '{$vo->TranscodeApp}', '{$vo->TranscodeTemplate}')">删除</a>
                    </td>
                </tr>
            </foreach>
            </tfoot>
        </table>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    // 删除
    function DeleteLiveStreamTranscode(Domain, App, Template)
    {
        var data = {
            Domain:Domain,
            App:App,
            Template:Template,
        }
        art.dialog({
            id: 'warning',
            icon: 'warning',
            title: '提示',
            content: '确定删除此配置？',
            cancelVal: '关闭',
            ok: function () {
               myAjax("{:url('Alsdk/DeleteLiveStreamTranscode')}", data)
            }
        });
    }

    // 执行提交
    function myAjax(url, data){
        $.ajax({
            url: url,
            dataType: 'json',
            data: data,
            type: "POST",
            success: function(data){
                if (data.code == '1') {
                    noty({
                        text: data.msg,
                        type: 'success',
                        layout: 'topCenter',
                        modal: true,
                        timeout: 800,
                        callback: {
                            afterClose: function () {
                                if (data.url) {
                                    window.location.href = data.url;//返回带跳转地址              
                                } else {
                                    //刷新当前页
                                    reloadPage(window);
                                }
                            }
                        }
                    }).show();
                } else if (data.code == '0') {
                    art.dialog({
                        content: data.msg,
                        icon: 'warning',
                        ok: function () {
                            this.title(data.msg);
                            return true;
                        }
                    });
                }
            }
        }); 
    }

</script>
</body>
</html>